package com.jy.adscm.operation.purchase.mapper.mysql;


import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.jy.adscm.operation.purchase.bean.Purchasebom;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * bom清单表 Mapper 接口
 * </p>
 *
 * @author lzf
 * @since 2019-05-14
 */
public interface PurchasebomMapper extends BaseMapper<Purchasebom> {

    @Select("SELECT\n" +
            "\t*, SUM( nums ) as num,\n" +
            "\tCOUNT( specification ) AS count \n" +
            "FROM\n" +
            "\tpurchasebom \n" +
            "GROUP BY\n" +
            "\t`name`,specification \n" +
            "HAVING\n" +
            "\tcount >1 ORDER BY `NAME`")
   List<Purchasebom> disadleData();

    @Select("SELECT * FROM purchasebom WHERE parentId1 is NOT NULL")
    List<Purchasebom> queryByFirst();


    List<Purchasebom> queryByAll(@Param("pid")Integer pid,
                                 @Param("pid2")String pid2,
                                 @Param("pid3")String pid3,
                                 @Param("pid4")String pid4,
                                 @Param("type")String type);


    List<Purchasebom> queryByBom();
}
